<template>
  <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
    <el-tab-pane label="文章管理" name="first"></el-tab-pane>
    <el-tab-pane label="文章发布" name="second"></el-tab-pane>
  </el-tabs>
  <router-view></router-view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { TabsPaneContext } from 'element-plus'

import { useRouter } from 'vue-router'
const router = useRouter()

const activeName = ref('first')

const handleClick = (tab: TabsPaneContext, event: Event) => {
  console.log(tab, event)
  console.log(tab.paneName)
  if (tab.paneName === 'first') {
    router.push('/')
  } else if (tab.paneName === 'second') {
    router.push('/addItem')
  }
}
</script>
<style lang="css" scoped>
.demo-tabs > .el-tabs__content {
  padding: 32px;
  color: #6b778c;
  font-size: 32px;
  font-weight: 600;
}
</style>
